#!/bin/sh
source /etc/profile
BR_ZK_HOST={{ zk_address }}

len="$#"

#global: global.xml
if [[ $len == 0 || global == "$1" ]]
then
    java -Dfile.encoding=UTF8 -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.global_path}} {{br.root}}/conf/global.xml &>/dev/null
    java -Dfile.encoding=UTF8 -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.previous_global_path}} {{br.root}}/conf/previous_global.xml &>/dev/null
fi


#zeus:zeus-conf.xml
if [[ $len == 0 || zeus == "$1" ]]
then
    java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.zeus_path}} {{br.root}}/conf/zeus-conf.xml &>/dev/null
fi

#Server:server-config-raw.xml
if [[ server == "$1" ]]
then
    java -Dfile.encoding=UTF8 -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.server_path}} {{br.root}}/conf/server-conf-raw.xml  &>/dev/null
fi

#sso: sso-config-raw.xml
if [[ $len == 0 || sso == "$1" ]]
then
    java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.sso_path}} {{br.root}}/conf/sso-conf-raw.xml  &>/dev/null
fi

#bop: bop-conf-raw.xml
#java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} /bonree/config/bop {{br.root}}/conf/bop-conf-raw.xml  &>/dev/null

#management
if [[ $len == 0 || management == "$1" ]]
then
    java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} /bonree/config/management {{br.root}}/conf/management.xml  &>/dev/null
fi

#SDK: sdk-config-raw.xml
if [[ sdk == "$1" ]]
then
    java -jar {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.sdk_path}} {{br.root}}/conf/sdk-config-raw.xml &>/dev/null
fi

#DataView view-config-raw.xml
#java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.dataview_path}} {{br.root}}/conf/view-config-raw.xml  &>/dev/null

#MP: mp-conf-raw.xml
#java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} /bonree/config/mp {{br.root}}/conf/mp-conf-raw.xml  &>/dev/null


#Browser: browser-config-raw.xml
if [[ browser == "$1" ]]
then
    java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.browser_path}} {{br.root}}/conf/browser-conf-raw.xml  &>/dev/null
fi

# WinSDK: winsdk-config-raw.xml
if [[ winsdk == "$1" ]]
then
    java -jar  {{br.root}}/jar/Bonree_Zookeeper_Write.jar ${BR_ZK_HOST} {{zk.winsdk_path}} {{br.root}}/conf/winsdk-conf-raw.xml  &>/dev/null
fi